package StructuralPattern.Bridge.Bridge;

/**
 * @Classname : PayVerify
 * @Description : 支付验证
 * @Author : chentianyu
 * @Date 2023/2/17 22:08
 */

/**
 * Abstraction——抽象化角色
 */
public abstract class PayVerify {
    private PayApp payApp;

    public PayVerify(PayApp payApp) {
        this.payApp = payApp;
    }

    public abstract void pay();

    public PayApp getPayApp() {
        return this.payApp;
    }
}


/**
 * RefinedAbstraction—修正抽象化角色
 */
// 人脸验证
class FacePay extends PayVerify {

    public FacePay(PayApp payApp) {
        super(payApp);
    }

    @Override
    public void pay() {
        System.out.println("人脸验证中。。。");
        super.getPayApp().pay();
    }
}

// 指纹验证
class FingerPrintPay extends PayVerify {

    public FingerPrintPay(PayApp payApp) {
        super(payApp);
    }

    @Override
    public void pay() {
        System.out.println("指纹验证中。。。");
        super.getPayApp().pay();
    }
}

// 密码验证
class PasswordPay extends PayVerify {

    public PasswordPay(PayApp payApp) {
        super(payApp);
    }

    @Override
    public void pay() {
        System.out.println("密码验证中。。。");
        super.getPayApp().pay();
    }
}